import React, { useState } from "react"

const TestUseState = () => {
  const [count, setCount] = useState(0)

  return (
    <div>
      <h1>Test UseState， Count: {count}</h1>
      <br />
      {/* <button onClick={() => setCount((v) => v + 1)}>Increment</button> */}
      <button
        onClick={() => {
          // 第一种方式
          // setCount((v) => v + 1)
          // setCount((v) => v + 2)
          // setCount((v) => v + 3)

          // 第二种方式
          // setCount(count + 1)
          // setCount(count + 2)
          // setCount(count + 3)

          // ttt
          setCount(count + 1)

          setCount(count + 8)
          setCount((count) => count + 3)
          setCount(count + 2)
        }}
      >
        批量执行
      </button>
    </div>
  )
}

export default TestUseState
